package com.isczy.userservice.utils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/********************************************
 * @Brief: 读取Yaml常量类
 * @Version: 1.0
 * @Date: 2020年12月30日 10:04:04
 * @Author: ChangZiYang
 * ******************************************
 */
@Component
public class YamlConstant implements InitializingBean {

    @Value("${wx.open.app_id}")
    private String appId;

    @Value("${wx.open.app_secret}")
    private String appSecret;

    @Value("${wx.open.redirect_url}")
    private String redirectUrl;

    private YamlConstant(){}

    public static String APP_ID;
    public static String APP_SECRET;
    public static String REDIRECT_URL;

    @Override
    public void afterPropertiesSet() throws Exception {
        YamlConstant.APP_ID = this.appId;
        YamlConstant.APP_SECRET = this.appSecret;
        YamlConstant.REDIRECT_URL = this.redirectUrl;
    }
}
